using System;
using System.Collections;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Web;
using System.Web.SessionState;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.HtmlControls;

using EntLibEC.Biz.RMA;

namespace EntLibEC.View.RMA
{
	/// <summary>
	/// Summary description for RevertStock.
	/// </summary>
	public partial class RevertStock  : PageBase
	{
		protected EntLibEC.View.Cmn.Stock ucStock ;
		protected int sysno;
		protected string bodyOnLoad;
	
		protected void Page_Load(object sender, System.EventArgs e)
		{
			if (Request.QueryString["SysNo"] != null)
			{
				try
				{
					sysno = int.Parse(Request.QueryString["SysNo"]);
				}
				catch
				{
					Assert(lblMessage, "sysno is not an integer", -1);
					return;
				}
			}
			else
			{
				Assert(lblMessage , "Error!" , -1);
				return;
			}

			if (!Page.IsPostBack)
				ucStock.BindStock(true);
		}

		#region Web Form Designer generated code
		override protected void OnInit(EventArgs e)
		{
			//
			// CODEGEN: This call is required by the ASP.NET Web Form Designer.
			//
			InitializeComponent();
			base.OnInit(e);
		}
		
		/// <summary>
		/// Required method for Designer support - do not modify
		/// the contents of this method with the code editor.
		/// </summary>
		private void InitializeComponent()
		{    

		}
		#endregion

		protected void btnOK_Click(object sender, System.EventArgs e)
		{
			try
			{
				RMARevertManager.GetInstance().SetRevertStock(sysno , ucStock.StockSysNo);
				bodyOnLoad = "javascript:window.opener.__doPostBack('btnOK','btnOK');window.close(); return false;";
			}
			catch
			{
			    Assert(lblMessage , "Error!" , -1);
			}
		}
	}
}
